<template lang="html">
  <div class="dynamic-detail">
     <!-- <div class="line">
        <span class="line_btn" @click="goBack">返回上一页 >></span>
    </div> -->
    <go-back></go-back>
    <div class="dynamic-container">
      <h2>{{data.title}}</h2>
      <ul>
        <li>浏览量：{{data.readingAmount}}</li>
        <li>发布时间：{{data.createdAt | timeFormat}}</li>
        <!--<li>作者：{{data.author}}</li>-->
      </ul>
      <div v-html="data.content" class="content"></div>
    </div>
  </div>
</template>

<script>
import {getDetail} from 'api/article.js'

import GoBack from 'components/index/goback/goback.vue'

export default {
  data() {
    return {
      data: ''
    }
  },
  created() {
    this._getDetail(this.$route.params.id)
  },
  methods: {
    _getDetail(id) {
      getDetail(id).then((res) => {
        this.data = res
        console.log(this.data)
      })
    },
    goBack() {
      this.$router.go(-1)
    }
  },
  components: {
    GoBack
  }
}
</script>

<style lang="scss">
.dynamic-detail{
  padding-bottom: 5%;
  .line{
    height: 44px;
    background: rgba(231,231,231,0.2);
    border-bottom: 1px solid rgba(221,221,221,0.5);
    width: 1200px;
    margin-left: 18%;
    span{
      font-size: 14px;
      color: #777;
      line-height: 44px;
      margin-left: 10px;
      cursor: pointer;
    }
  }
  .dynamic-container{
    width: 1200px;
    margin:0 auto;
    padding-top: 50px;
    h2{
      font-size: 24px;
      text-align: center;
      margin-bottom: 40px;
    }
    ul{
      display: flex;
     justify-content: center;
      margin-bottom: 30px;
      li{
        padding-left: 5%;
        color: #777777;
        /*&:not(:first-child){
          padding-right: 36px;
        }*/
      }
    }
    .content{
      /*text-align: center;*/
      padding-bottom: 10%;
        p{
          font-size: 16px;
          line-height: 30px;
          letter-spacing: 1px;
          /*text-indent: 30px;*/
        }
      div{
        line-height: 30px;
      }
      img{
        width: 360px;
        margin-top: 10px;
        margin-left: 20px;
      }
    }
  }
}
</style>
